package com.epam.kozich;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.epam.kozich.dao.BookDAO;
import com.epam.kozich.dao.PersonDAO;
import com.epam.kozich.model.Book;
import com.epam.kozich.model.Person;


public class Runner {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ApplicationContext context = new ClassPathXmlApplicationContext("resources/config.xml");
		
		BookDAO bookDAO = (BookDAO) context.getBean("BookDAO");
		PersonDAO personDAO = (PersonDAO) context.getBean("PersonDAO");
		
		Book book = new Book(2,"Book 1","Andrei",2012);
		Person person = new Person(6,"Dafna", "07760776");
		Book book2 = new Book (1,"Book 2","Setterfild",2006);
		
		
		//person.addBook(book);
		personDAO.updatePerson(person);
		//personDAO.deletePerson(person);
		//bookDAO.deleteBook(book);
		//bookDAO.deleteBook(book2);
		//person.addBook(book2);
		//book.setPerson(person);
		//personDAO.addPerson(person);
		
	}

}
